package com.itheima.demo07newdatetimeapi;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Demo01 {
    public static void main(String[] args) {
        //设计不合理
        Date now = new Date(1985,9,23);
        System.out.println("date = " + now);

        //2.线程不安全
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        /*try {
            Date date = sdf.parse("2099-09-09");
            System.out.println("date = " + date);
        } catch (ParseException e) {
            e.printStackTrace();
        }*/

        for (int i = 0; i < 50; i++) {
            new Thread(
                    ()->{
                        Date date = null;
                        try {
                            date = sdf.parse("2019-09-09");
                            System.out.println("date = " + date);
                        } catch (ParseException e) {
                            e.printStackTrace();
                        }
                    }
            ).start();
        }
    


    }
}
